<?php

include  dirname(__FILE__).'/deamon.php';
include   dirname(__FILE__).'/redis.php';

  $deamon=new deamon;
  $deamon->deamon();

  $client = new swoole_client(SWOOLE_SOCK_TCP);//创建swoole tcp客户端
  $client->connect('127.0.0.1', 9501, 10) or die("连接失败");//连接swoole_server


  
while(true)  
{  


  $redis=RedisManager::getRedisConn(); 
  $lenth= $redis->llen("mem");

  if ($lenth < 1) {
    echo "队列中没有了";
      sleep(5);
   }else{

   $data=$redis->LPOP('mem');

   
   $client->send($data);//发送要执行的sql
  
     usleep(50000);
   
  }
}  


